package astudy.networking.tcp;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class CommandServer {

	public static void main(String[] args) {
		
		ServerSocket server = null;
		try {
			server = new ServerSocket(9999);
			System.out.println("Server Start at Port: " + 9999);
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(-1);
		}
		while (true) {
			try {
				Socket client = server.accept();
				new Thread(new CommandThread(client)).start();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}
}
